import path from 'path';
import url from 'url';

const filePath='./dir1/dir2/test.txt';
console.log(path.basename(filePath));
console.log(path.dirname(filePath));
console.log(path.extname(filePath));
console.log(path.parse(filePath));

const _filename =url.fileURLToPath(import.meta.url);
const _dirname=path.dirname(_filename);

const filePath2=path.join(_dirname,'dir1','dir2','test.txt');
console.log(filePath2);


const filePath3=path.resolve(_dirname,'dir1','dir2','test.txt');
console.log(filePath3);